local switchBtns = {
    [5] = '1',
    [4] = '7'
}

OutputLogMessage("分隔------------------------------------------------------分隔\n")
EnablePrimaryMouseButtonEvents(true)

function toggleBag(slot)
    PressKey('b')
    Sleep(math.random(28, 80))
    PressKey(slot)
    Sleep(math.random(15, 80))
    ReleaseKey('b')
    Sleep(math.random(50, 98))
    ReleaseKey(slot)
end

function OnEvent(event, arg)
    if event == "MOUSE_BUTTON_PRESSED" and IsKeyLockOn("capslock") then
        local slot = switchBtns[arg]
        if slot then
            toggleBag(slot)
        end
    end
end
